//
//  YHYEditDetailViewController.m
//  Home
//
//  Created by 杨泓晔 on 16/4/26.
//  Copyright © 2016年 LanJue. All rights reserved.
//

#import "YHYEditDetailViewController.h"
#import "WSCustomLabel.h"
#import "YHYAddViewController.h"
#import <SDCycleScrollView.h>
#import <MWPhotoBrowser.h>

@interface YHYEditDetailViewController ()<SDCycleScrollViewDelegate, MWPhotoBrowserDelegate>

{
     NSInteger rowHeight;
    NSMutableArray *_photos;
    NSMutableArray *_thumbs;
    NSArray *array;
}

@property (nonatomic,retain)UIScrollView *myScrollView;
@property (nonatomic,retain)UIImageView *BackimageView;
@property (nonatomic,retain)UIImageView *myImageView;
@property (nonatomic,retain)UILabel *nameL;
@property (nonatomic,retain)UILabel *priceL;
@property (nonatomic,retain)UILabel *sizeL;
@property (nonatomic,retain)UILabel *styleL;
@property (nonatomic,retain)UILabel *addressL;
@property (nonatomic,retain)UIButton *button;
@property (nonatomic,strong)UIButton *removeBotton;


@property (nonatomic,strong)UILabel *mianjiL;
@property (nonatomic,strong)UILabel *jingyanL;
@property (nonatomic,strong)UILabel *shejiL;
@property (nonatomic,retain)UIImageView *detailBackIV;
//@property (nonatomic,retain)UILabel *nameL;


@property (nonatomic, strong) WSCustomLabel *contentLabel;
@property (nonatomic, strong) UIImageView *lineV;
@property (nonatomic, strong) UIButton *showAll;
@property (nonatomic, strong) SDCycleScrollView *imgView;

@end

@implementation YHYEditDetailViewController

- (void)viewWillAppear:(BOOL)animated {
    
    self.title = @"任务详情";
    self.tabBarController.tabBar.hidden=YES;
    self.navigationController.navigationBarHidden = NO;
    
    self.navigationController.navigationBar.translucent = NO;
    
}

-(void) viewWillDisappear:(BOOL)animated
{

  self.navigationController.navigationBar.translucent = NO;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _myScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    self.myScrollView.backgroundColor = LV;
    [self.view addSubview:_myScrollView];
     _myScrollView.contentSize = CGSizeMake(SCREEN_WIDTH, 900 * AUTO_HEIGHT + rowHeight * AUTO_HEIGHT);
    [self creatView];
    [self creatDetailView];
    
    
}


- (void)showAllAction:(UIButton *)btn {
    //NSLog(@"e2qe");
    
    btn.selected = !btn.isSelected;
   
   
    if (!btn.isSelected) {
        [self.showAll setTitle:@"显示全部" forState:UIControlStateNormal];
        [self.detailBackIV mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(_BackimageView.mas_bottom).offset(8 * AUTO_HEIGHT);
            make.left.mas_equalTo(16/2 * AUTO_WIDTH);
            make.right.mas_equalTo(self.view.mas_right).offset(- 8 * AUTO_WIDTH);
            make.height.mas_equalTo(170 * AUTO_HEIGHT);
            
            
        }];
        rowHeight = 170;
        

    }
    else {
        [self.showAll setTitle:@"收起" forState:UIControlStateNormal];
        [self.detailBackIV mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(_BackimageView.mas_bottom).offset(8 * AUTO_HEIGHT);
            make.left.mas_equalTo(16/2 * AUTO_WIDTH);
            make.right.mas_equalTo(self.view.mas_right).offset(- 8 * AUTO_WIDTH);
            make.height.mas_equalTo(215 * AUTO_HEIGHT);
            
            
        }];
        rowHeight = 215;
    }
}


- (void)goNext:(UIButton *)btu{
    YHYAddViewController *addVC = [YHYAddViewController new];
    [self.navigationController pushViewController:addVC animated:YES];
}
- (void)removeBotton:(UIButton *)btu{
    
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)Back:(UIButton *)btu{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)creatDetailView{
   
    self.detailBackIV = [UIImageView new];
    [self.myScrollView addSubview:self.detailBackIV];
    self.detailBackIV.backgroundColor = [UIColor whiteColor];
    self.detailBackIV.userInteractionEnabled = YES;
    [self.detailBackIV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_BackimageView.mas_bottom).offset(8 * AUTO_HEIGHT);
        make.left.mas_equalTo(16/2 * AUTO_WIDTH);
        make.right.mas_equalTo(self.view.mas_right).offset(- 8 * AUTO_WIDTH);
        make.height.mas_equalTo(170 * AUTO_HEIGHT);
        
    }];
    self.detailBackIV.layer.masksToBounds = YES;
    self.detailBackIV.layer.cornerRadius = 5 * AUTO_WIDTH;
    
    //
    UILabel *nameL = [UILabel new];
    nameL.text = @"详细描述";
    nameL.textColor = GH;
    nameL.font = [UIFont fontWithName:TFont size:TEXTNAMEFONT * AUTO_WIDTH];
    [_detailBackIV addSubview:nameL];
    [nameL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(5 * AUTO_HEIGHT);
        make.height.mas_equalTo(70/2 * AUTO_HEIGHT);
        make.left.mas_equalTo(15 * AUTO_WIDTH);
        
    }];
    
    UIImageView *image = [UIImageView new];
    [self.detailBackIV addSubview:image];
    image.image = [UIImage imageNamed:@"detail"];
    [image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(nameL).offset(4 *AUTO_HEIGHT);
        make.right.mas_equalTo(self.view).offset(- 15 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(25 * AUTO_WIDTH, 25* AUTO_HEIGHT));
        
        
    }];
    
    //
    //
    //
    UIImageView *li = [UIImageView new];
    [self.detailBackIV addSubview:li];
    [li mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(nameL.mas_bottom).offset(0/2 * AUTO_HEIGHT);
        make.left.mas_equalTo(1 * AUTO_WIDTH);
        make.height.mas_equalTo(1.5 * AUTO_HEIGHT);
        make.right.mas_equalTo(- 1 * AUTO_WIDTH);
        
    }];
    li.image = [UIImage imageNamed:@"虚线"];
    
    self.contentLabel = [[WSCustomLabel alloc] init];
    [self.detailBackIV addSubview:_contentLabel];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(56 * AUTO_WIDTH);
        make.left.mas_equalTo(@(15 * AUTO_WIDTH));
        make.right.mas_equalTo(@(-15 * AUTO_WIDTH));
        make.bottom.mas_equalTo(@(-40 * AUTO_WIDTH));
    }];
    NSString *labelText = @"雪花啤酒广告平面拍摄代言人\n视频作品：凯撒柔思面膜广告微电影饰演女二\n杭州野生动物园宣传片.饰演情侣.\n浙江少儿频道微电影《绽放》饰演女主婷婷.\n浙江少儿频道微电影《绽放》饰演女主婷婷.\n浙江少儿频道微电影《绽放》饰演女主婷婷.\n浙江少儿频道微电影《绽放》饰演女主婷婷.\n浙江少儿频道微电影《绽放》饰演女主婷婷.\n浙江少儿频道微电影《绽放》饰演女主婷婷.";
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:labelText];
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [labelText length])];
    self.contentLabel.attributedText = attributedString;
    self.contentLabel.textColor = [UIColor colorWithRed:0.52 green:0.51 blue:0.52 alpha:1];
    self.contentLabel.numberOfLines = 0;
    self.contentLabel.font = [UIFont systemFontOfSize:TEXTLABELFONT * TEXTWEIGHT];
    self.lineV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"虚线"]];
    [self.detailBackIV addSubview:_lineV];
    [self.lineV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentLabel.mas_bottom).offset( 1);
        make.left.mas_equalTo(@8);
        make.right.mas_equalTo(@-8);
        make.height.mas_equalTo(@1);
    }];
    self.showAll = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.detailBackIV addSubview:_showAll];
    //self.showAll.backgroundColor = [UIColor redColor];
    [self.showAll mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(@(15 * AUTO_WIDTH));
        make.top.equalTo(_lineV.mas_bottom);
        make.right.mas_equalTo(@(-15 * AUTO_WIDTH));
        make.bottom.mas_equalTo(@0);
    }];
    [self.showAll setTitle:@"显示全部" forState:UIControlStateNormal];
    [self.showAll setTitleColor:ZI forState:UIControlStateNormal];
    self.showAll.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.showAll.titleLabel.font = [UIFont systemFontOfSize:TEXTCONTENTFONT *TEXTWEIGHT];
    // self.showAll.backgroundColor = [UIColor redColor];
    [self.showAll addTarget:self action:@selector(showAllAction:) forControlEvents:UIControlEventTouchUpInside];
    

    
    //下一步
    self.button = [UIButton buttonWithType:UIButtonTypeCustom];
    self.button.backgroundColor = GH;
    [self.myScrollView addSubview:_button];
    self.button.layer.masksToBounds = YES;
    self.button.layer.cornerRadius = 5;
    [self.button setTitle:@"编 辑" forState:UIControlStateNormal];
    [self.button addTarget:self action:@selector(goNext:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    
    [self.button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_detailBackIV.mas_bottom).offset(44 * AUTO_HEIGHT);
        make.centerXWithinMargins.mas_equalTo(self.myScrollView);
        make.height.mas_equalTo(78/2 * AUTO_HEIGHT);
        make.width.mas_equalTo(SCREEN_WIDTH - 88/2 * AUTO_WIDTH);
    }];
    self.button.titleLabel.font = [UIFont fontWithName:@"Arial" size:LOGINFONT * TEXTWEIGHT];
    
    
    _removeBotton = [UIButton new];
    [self.myScrollView addSubview:_removeBotton];
    self.removeBotton.backgroundColor = [UIColor colorWithRed:248/255.0 green:84/255.0 blue:85/255.0 alpha:1];
    [self.myScrollView addSubview:_removeBotton];
    self.removeBotton.layer.masksToBounds = YES;
    self.removeBotton.layer.cornerRadius = 5;
    [self.removeBotton setTitle:@"删 除" forState:UIControlStateNormal];
    [self.removeBotton addTarget:self action:@selector(removeBotton:) forControlEvents:UIControlEventTouchUpInside];
    [self.removeBotton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    
    [self.removeBotton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_button.mas_bottom).offset(30 * AUTO_HEIGHT);
        make.centerXWithinMargins.mas_equalTo(self.myScrollView);
        make.height.mas_equalTo(78/2 * AUTO_HEIGHT);
        make.width.mas_equalTo(SCREEN_WIDTH - 88/2 * AUTO_WIDTH);
    }];
    self.removeBotton.titleLabel.font = [UIFont fontWithName:@"Arial" size:LOGINFONT * TEXTWEIGHT];
    
}


- (void)creatView{
    //    左侧的图标
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"] style:UIBarButtonItemStylePlain target:self action:@selector(Back:)];
    self.navigationItem.leftBarButtonItem.tintColor = [UIColor whiteColor];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = LV;
    self.BackimageView = [UIImageView new];
    self.BackimageView.userInteractionEnabled=YES;
    [self.myScrollView addSubview:self.BackimageView];
    self.BackimageView.backgroundColor = [UIColor whiteColor];
    [self.BackimageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(8 * AUTO_HEIGHT);
        make.left.mas_equalTo(16/2 * AUTO_WIDTH);
        make.right.mas_equalTo(self.view.mas_right).offset(- 8 * AUTO_WIDTH);
        make.height.mas_equalTo(445 * AUTO_HEIGHT);
        
    }];
    self.BackimageView.layer.masksToBounds = YES;
    self.BackimageView.layer.cornerRadius = 5 * AUTO_WIDTH;
    
    
    _myImageView = [UIImageView new];
    [self.BackimageView addSubview:_myImageView];
    _myImageView.userInteractionEnabled=YES;
    [_myImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.BackimageView.mas_top).offset(7 * AUTO_HEIGHT);
        make.left.mas_equalTo(self.BackimageView.mas_left).offset(7 * AUTO_WIDTH);
        make.right.mas_equalTo(self.BackimageView.mas_right).offset(- 7 * AUTO_WIDTH);
        make.height.mas_equalTo(210 * AUTO_HEIGHT);
        
    }];
    
    
 array=@[@"u=957005295,3708602591&fm=206&gp=0.jpg",@"u=957005295,3708602591&fm=206&gp=0.jpg",@"u=957005295,3708602591&fm=206&gp=0.jpg"];
    
    self.imgView=[SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width-32 *AUTO_WIDTH, 210 *AUTO_HEIGHT) imageURLStringsGroup:array];
    self.imgView.clipsToBounds=YES;
    self.imgView.delegate=self;
    self.imgView.userInteractionEnabled=YES;
    self.imgView.delegate=self;
    self.imgView.infiniteLoop=YES;
    self.imgView.pageControlStyle = SDCycleScrollViewPageContolStyleClassic;
    self.imgView.autoScrollTimeInterval = 3;
    [_myImageView addSubview:self.imgView];

    
    
    
    _nameL = [UILabel new];
    _nameL.text = @"湖滨花园";
    _nameL.textColor = GH;
    _nameL.font = [UIFont fontWithName:TFont size:TEXTNAMEFONT * AUTO_WIDTH];
    [self.BackimageView addSubview:_nameL];
    [_nameL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_myImageView.mas_bottom).offset(5 * AUTO_HEIGHT);
        make.centerXWithinMargins .mas_equalTo(self.BackimageView);
        make.height.mas_equalTo(70/2 * AUTO_HEIGHT);
        
    }];
    
    UIImageView *line = [UIImageView new];
    [self.BackimageView addSubview:line];
    line.image = [UIImage imageNamed:@"虚线"];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_nameL.mas_bottom).offset(5 * AUTO_HEIGHT);
        make.left.mas_equalTo((14  )* AUTO_WIDTH);
        make.right.mas_equalTo(- (14) * AUTO_WIDTH);
        make.height.mas_equalTo(1.5 * AUTO_HEIGHT);
        
    }];
    
    //钱
    UIImageView *priceImageView = [UIImageView new];
    priceImageView.image = [UIImage imageNamed:@"qiang2x"];
    [self.BackimageView addSubview:priceImageView];
    [priceImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(line.mas_bottom).offset(20 * AUTO_HEIGHT);
        make.left.mas_equalTo(36 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(15 * AUTO_WIDTH, 15 * AUTO_WIDTH));
        
    }];
    
    UIImageView *suxian1 = [UIImageView new];
    [self.BackimageView addSubview:suxian1];
    suxian1.image = [UIImage imageNamed:@"虚线竖"];
    [suxian1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(line.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.left.mas_equalTo(85 * AUTO_WIDTH);
        make.height.mas_equalTo(60 * AUTO_HEIGHT);
    }];
    
    _priceL = [UILabel new];
    _priceL.text = @"30";
    _priceL.textColor = ZI;
    _priceL.textAlignment = NSTextAlignmentCenter;
    _priceL.font = [UIFont fontWithName:TFont size:TEXTALITTLEFONT * AUTO_WIDTH];
    [self.BackimageView addSubview:_priceL];
    [_priceL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(priceImageView.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.height.mas_equalTo(priceImageView);
        make.left.mas_equalTo(self.BackimageView);
        make.right.mas_equalTo(suxian1.mas_right);
        
        
    }];
    
    
    //定位
    UIImageView *PingFangImageView = [UIImageView new];
    PingFangImageView.image = [UIImage imageNamed:@"di"];
    [self.BackimageView addSubview:PingFangImageView];
    [PingFangImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(line.mas_bottom).offset(20 * AUTO_HEIGHT);
        make.left.mas_equalTo(suxian1.mas_right).offset(35 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(15 * AUTO_WIDTH, 15 * AUTO_WIDTH));
        
    }];
    
    
    
    
    
    
    
    UIImageView *suxian2 = [UIImageView new];
    [self.BackimageView addSubview:suxian2];
    suxian2.image = [UIImage imageNamed:@"虚线竖"];
    [suxian2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(line.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.left.mas_equalTo(85 *2* AUTO_WIDTH);
        make.height.mas_equalTo(60 * AUTO_HEIGHT);
    }];
    _sizeL = [UILabel new];
    _sizeL = [UILabel new];
    _sizeL.text = @"北京市";
    _sizeL.textColor = ZI;
    _sizeL.textAlignment = NSTextAlignmentCenter;
    _sizeL.font = [UIFont fontWithName:TFont size:TEXTALITTLEFONT * AUTO_WIDTH];
    [self.BackimageView addSubview:_sizeL];
    [_sizeL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(PingFangImageView.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.height.mas_equalTo(priceImageView);
        make.left.mas_equalTo(suxian1);
        make.right.mas_equalTo(suxian2.mas_right);
        
        
    }];
    
    //建筑设计
    UIImageView *homeIV = [UIImageView new];
    [self.BackimageView addSubview:homeIV];
    homeIV.image = [UIImage imageNamed:@"sheji"];
    [homeIV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(line.mas_bottom).offset(20 * AUTO_HEIGHT);
        make.left.mas_equalTo(suxian2.mas_right).offset(33 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(18 * AUTO_WIDTH, 18 * AUTO_WIDTH));
        
    }];
    
    
    
    UIImageView *suxian3 = [UIImageView new];
    [self.BackimageView addSubview:suxian3];
    suxian3.image = [UIImage imageNamed:@"虚线竖"];
    [suxian3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(line.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.left.mas_equalTo(85 * 3* AUTO_WIDTH);
        make.height.mas_equalTo(60 * AUTO_HEIGHT);
    }];
    
    
    
    _styleL = [UILabel new];
    _styleL = [UILabel new];
    _styleL.text = @"建筑设计";
    _styleL.textColor = ZI;
    _styleL.textAlignment = NSTextAlignmentCenter;
    _styleL.font = [UIFont fontWithName:TFont size:TEXTALITTLEFONT * AUTO_WIDTH];
    [self.BackimageView addSubview:_styleL];
    [_styleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(PingFangImageView.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.height.mas_equalTo(priceImageView);
        make.left.mas_equalTo(suxian2);
        make.right.mas_equalTo(suxian3.mas_right);
        
        
    }];
    
    //风格
    UIImageView *addressIV = [UIImageView new];
    [self.BackimageView addSubview:addressIV];
    addressIV.image = [UIImage imageNamed:@"fenge"];
    [addressIV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(line.mas_bottom).offset(20 * AUTO_HEIGHT);
        make.left.mas_equalTo(suxian3.mas_right).offset(36 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(15 * AUTO_WIDTH, 15 * AUTO_WIDTH));
        
        
    }];
    
    _addressL = [UILabel new];
    _addressL = [UILabel new];
    _addressL = [UILabel new];
    _addressL.text = @"法式风格";
    _addressL.textColor = ZI;
    _addressL.textAlignment = NSTextAlignmentCenter;
    _addressL.font = [UIFont fontWithName:TFont size:TEXTALITTLEFONT * AUTO_WIDTH];
    
    [self.BackimageView addSubview:_addressL];
    [_addressL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(PingFangImageView.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.height.mas_equalTo(priceImageView);
        make.left.mas_equalTo(suxian3);
        //make.right.mas_equalTo(suxian3.mas_right);
        make.right.mas_equalTo(self.BackimageView);
        
        
    }];
    
    
    
    UIImageView *lineBottom = [UIImageView new];
    [self.BackimageView addSubview:lineBottom];
    lineBottom.image = [UIImage imageNamed:@"虚线"];
    [lineBottom mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(suxian1.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.left.width.height.mas_equalTo(line);
        
    }];
    
    
    
    
    
    //面积
    UIImageView *mianjiImageView = [UIImageView new];
    mianjiImageView.image = [UIImage imageNamed:@"pingfang"];
    [self.BackimageView addSubview:mianjiImageView];
    [mianjiImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(lineBottom.mas_bottom).offset(20 * AUTO_HEIGHT);
        make.left.mas_equalTo(40 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(15 * AUTO_WIDTH, 15 * AUTO_WIDTH));
        
    }];
    
    UIImageView *suxian4 = [UIImageView new];
    [self.BackimageView addSubview:suxian4];
    suxian4.image = [UIImage imageNamed:@"虚线竖"];
    [suxian4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(lineBottom.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.left.mas_equalTo(85 * AUTO_WIDTH);
        make.height.mas_equalTo(60 * AUTO_HEIGHT);
    }];
    
    _mianjiL = [UILabel new];
    _mianjiL.text = @"30㎡";
    _mianjiL.textColor = ZI;
    _mianjiL.textAlignment = NSTextAlignmentCenter;
    _mianjiL.font = [UIFont fontWithName:TFont size:TEXTALITTLEFONT * AUTO_WIDTH];
    [self.BackimageView addSubview:_mianjiL];
    [_mianjiL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(mianjiImageView.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.height.mas_equalTo(priceImageView);
        make.left.mas_equalTo(_myImageView);
        make.right.mas_equalTo(suxian4.mas_right);
        
        
    }];
    
    
    
    
    
    //经验
    UIImageView *jingyanImageView = [UIImageView new];
    jingyanImageView.image = [UIImage imageNamed:@"jingyan"];
    [self.BackimageView addSubview:jingyanImageView];
    [jingyanImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(lineBottom.mas_bottom).offset(20 * AUTO_HEIGHT);
        make.left.mas_equalTo(suxian4.mas_right).offset(35 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(15 * AUTO_WIDTH, 15 * AUTO_WIDTH));
        
    }];
    
    
    
    
    
    
    
    UIImageView *suxian5 = [UIImageView new];
    [self.BackimageView addSubview:suxian5];
    suxian5.image = [UIImage imageNamed:@"虚线竖"];
    [suxian5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(lineBottom.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.left.mas_equalTo(85 *2* AUTO_WIDTH);
        make.height.mas_equalTo(60 * AUTO_HEIGHT);
    }];
    //_jingyanL = [UILabel new];
    _jingyanL = [UILabel new];
    _jingyanL.text = @"1-3年";
    _jingyanL.textColor = ZI;
    _jingyanL.textAlignment = NSTextAlignmentCenter;
    _jingyanL.font = [UIFont fontWithName:TFont size:TEXTALITTLEFONT * AUTO_WIDTH];
    [self.BackimageView addSubview:_jingyanL];
    [_jingyanL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(jingyanImageView.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.height.mas_equalTo(_mianjiL);
        make.left.mas_equalTo(suxian4.mas_right);
        make.right.mas_equalTo(suxian2.mas_right);
        
        
    }];
    
    
    //纯设计
    UIImageView *signIV = [UIImageView new];
    [self.myImageView addSubview:signIV];
    signIV.image = [UIImage imageNamed:@"icons"];
    [signIV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(jingyanImageView);
        make.height.mas_equalTo(jingyanImageView);
        make.left.mas_equalTo(suxian5.mas_right).offset(85 * AUTO_WIDTH);
        make.width.mas_equalTo(jingyanImageView);
        
    }];
    
    
    _shejiL = [UILabel new];
    _shejiL = [UILabel new];
    _shejiL.text = @"纯设计需要跟单";
    _shejiL.textColor = ZI;
    _shejiL.textAlignment = NSTextAlignmentCenter;
    _shejiL.font = [UIFont fontWithName:TFont size:TEXTALITTLEFONT * AUTO_WIDTH];
    [self.BackimageView addSubview:_shejiL];
    [_shejiL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(suxian5.mas_right);
        make.height.mas_equalTo(_jingyanL);
        make.right.mas_equalTo(self.BackimageView.mas_right);
        make.top.mas_equalTo(_jingyanL);
        
    }];
    
    
    
    
    UIImageView *lineBottom2 = [UIImageView new];
    [self.BackimageView addSubview:lineBottom2];
    lineBottom2.image = [UIImage imageNamed:@"虚线"];
    [lineBottom2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(suxian5.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.left.width.height.mas_equalTo(line);
        
    }];
    
}

- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
{
    NSLog(@"tap tag is %ld", index);
    // Browser
    _photos = [[NSMutableArray alloc] init];
    _thumbs = [[NSMutableArray alloc] init];
    for (int i=0; i<array.count; i++)
    {
        MWPhoto *photo = [MWPhoto photoWithImage:[UIImage imageNamed:array[i]]];
        [_photos addObject:photo];
    }
    
    //    //调用父View的里面的方法
    //    WUDetailViewController *vc = (WUDetailViewController *)self.superview.superview.nextResponder;
    //    NSLog(@"%@", self.superview.superview.nextResponder);
    // Create browser
    MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
    browser.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"] style:UIBarButtonItemStylePlain target:self action:@selector(Back:)];
    browser.navigationItem.leftBarButtonItem.tintColor = [UIColor whiteColor];
    
    
    browser.displayActionButton = NO;//分享按钮,默认是
    browser.displayNavArrows = YES;//左右分页切换,默认否
    browser.displaySelectionButtons = NO;//是否显示选择按钮在图片上,默认否
    browser.alwaysShowControls = NO;//控制条件控件 是否显示,默认否
    browser.zoomPhotosToFill = YES;//是否全屏,默认是
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
    browser.wantsFullScreenLayout = YES;//是否全屏
#endif
    browser.enableGrid = YES;//是否允许用网格查看所有图片,默认是
    browser.startOnGrid = NO;//是否第一张,默认否
    browser.enableSwipeToDismiss = YES;
    [browser showNextPhotoAnimated:YES];
    [browser showPreviousPhotoAnimated:YES];
    [browser setCurrentPhotoIndex:index];
    
    
    [self.navigationController pushViewController:browser animated:NO];
}

#pragma mark - MWPhotoBrowserDelegate
-(id<MWPhoto>) photoBrowser:(MWPhotoBrowser *)photoBrowser thumbPhotoAtIndex:(NSUInteger)index
{
    return _photos[index];
}

- (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser {
    return _photos.count;
}


- (id )photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index {
    if (index < _photos.count)
        return [_photos objectAtIndex:index];
    return nil;
}





@end
